package sixthquestion;

import java.io.*;
import java.net.Socket;

public class Client {
    public static void main(String[] args) {
        Socket socket = null;
        InputStream is =null;
        OutputStream os = null;
        try {
            socket = new Socket("localhost",8800);
            is = new FileInputStream(new File("E:/蒋金鑫/MyPic/img01.JPG"));
            os = socket.getOutputStream();

            byte[] bytes = new byte[1024];
            int temp=0;
            while ((temp=is.read(bytes))!=-1){
                os.write(bytes,0,temp);
                os.flush();
            }

        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if (socket!=null){
                try {
                    socket.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
